home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pstoepsi.zip / PSTORAST < prev    next >
Text File  |  1991-08-02  |  2KB  |  82 lines

  1. #! /bin/sh
  2. # @(#)ps2bits 1.2 89/12/12
  3. # ps2bits - PostScript to Rasterfile converter.
  4. #
  5.  
  6. USAGE="Usage: `basename ${0}` [-in s] [-out s] [-dpi x y] [-size w h] [-color]"
  7. OUT="pspage"
  8. IN="%stdin"
  9. DPIX=72
  10. DPIY=72
  11. XSIZE=8.5
  12. YSIZE=11
  13. DEPTH=1
  14.  
  15. export OPENWINHOME XNEWSHOME LD_LIBRARY_PATH
  16.  
  17. OPENWINHOME="${OPENWINHOME-/usr/local/OpenWindows}"
  18. XNEWSHOME=${OPENWINHOME}
  19. LD_LIBRARY_PATH=${OPENWINHOME}/lib:/lib
  20.  
  21. if [ ! -f $OPENWINHOME/etc/NeWS/redbook.ps ]; then
  22.     echo "`basename $0`: xnews is not installed correctly in $OPENWINHOME" 1>&2
  23.     echo "    (set \$OPENWINHOME to where it is installed...)" 1>&2
  24.     exit 1
  25. fi
  26.  
  27. while [ ${#} -gt 0 ]; do
  28.     case "${1}" in
  29.     -color)    shift;
  30.         DEPTH=8
  31.     ;;
  32.     -out)    shift;
  33.         OUT=${1} shift
  34.     ;;
  35.     -in)    shift;
  36.         IN=${1} shift
  37.     ;;
  38.     -size)    shift;
  39.         XSIZE=${1} shift;
  40.         YSIZE=${1} shift
  41.     ;;
  42.     -dpi)    shift;
  43.         DPIX=${1} shift;
  44.         DPIY=${1} shift
  45.     ;;
  46.     *)    echo ${USAGE};
  47.         exit 0
  48.     ;;
  49.     esac
  50. done
  51.  
  52. $OPENWINHOME/bin/xnews -init "
  53.     /currentpacking false def
  54.     /setpacking { pop } def
  55.     (NeWS/basics.ps) (r) file cvx exec
  56.     (NeWS/redbook.ps) (r) file cvx exec
  57.  
  58.     500 dict begin    % start userdict
  59.     false setautobind
  60.     /bind {} def
  61.  
  62.     /showpage { copypage erasepage initgraphics } def
  63.     /_pageno 0 def
  64.     /copypage {
  65.         /_pageno _pageno 1 add store
  66.         (${OUT})
  67.         clippath writecanvas
  68.     } def
  69.  
  70.     ${DPIX} ${XSIZE} mul ${DPIY} ${YSIZE} mul ${DEPTH}
  71.     [ ${DPIX} 72 div 0 0 ${DPIY} 72 div neg 0 7 index ]
  72.     null buildimage setcanvas
  73.     erasepage initgraphics
  74.  
  75.     % hack for bug in folio initialization code.
  76.     /Courier findfont 10 scalefont setfont () stringwidth pop pop
  77.  
  78.     (${IN}) (r) file cvx exec
  79.     shutdownserver
  80. "
  81.  
  82.